package br.unisinos.tetris.factory;

import br.unisinos.tetris.pieces.I;
import br.unisinos.tetris.pieces.J;
import br.unisinos.tetris.pieces.L;
import br.unisinos.tetris.pieces.O;
import br.unisinos.tetris.pieces.Piece;
import br.unisinos.tetris.pieces.S;
import br.unisinos.tetris.pieces.T;
import br.unisinos.tetris.pieces.Z;
import br.unisinos.tetris.state.PieceState;
import br.unisinos.tetris.state.PieceState1;

public class Phase1Factory implements TetrisFactory {

	@Override
	public PieceState getRandomPiece() {
		Piece piece = null;

		int num = (int) (Math.random() * 7);
		switch (num) {
		case 0:
			piece = new I();
			break;
		case 1:
			piece = new J();
			break;
		case 2:
			piece = new L();
			break;
		case 3:
			piece = new O();
			break;
		case 4:
			piece = new S();
			break;
		case 5:
			piece = new T();
			break;
		case 6:
			piece = new Z();
			break;
		default:
			break;
		}

		piece.setX(90);
		piece.setY(0);
		return new PieceState1(piece);
	}
	
	public int getTimeClock() {
		return 300;
	}
	

}
